package com.lj.api.v1.c;


import com.lj.api.common.Result;
import com.lj.mcore.entity.GoodsBrand;
import com.lj.mcore.service.IGoodsBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/c")
public class GoodsBrandContorller {

    @Autowired
    IGoodsBrandService goodsBrandDao;

    @RequestMapping("/goodsBrandList")
    public String gcList(){
        List<GoodsBrand> brandList = goodsBrandDao.query(IGoodsBrandService.gcList_hql_,null,-1,-1);
        List list = new ArrayList();
        for (GoodsBrand goodsBrand:brandList){
            Map map = new HashMap();
            map.put("gbid",goodsBrand.getId());
            map.put("gb_name",goodsBrand.getName());
            list.add(map);
        }
        return Result.ok(list);
    }
}
